<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js" type="text/javascript"></script>
</head>
<body>
    <div id="app">
        <span v-if="isUser">
            <!-- label绑定输入框 -->
            <label for="username">用户账号</label>
            <input id="username" type="text" placeholder="用户账号">
            <button @click="btnClick">切换类型</button>
        </span>
        <span v-else>
            <label for="email">用户邮箱</label>
            <input id="email" type="text" placeholder="用户邮箱">
            <button @click="btnClick">切换类型</button>
        </span>
    </div>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                isUser: true
            },
            methods: {
                btnClick: function(){
                    this.isUser = !this.isUser
                }
            }

        })
    </script>
</body>
</html>